We will clean the environment, setup the locations, define colors, and create a datestamp.
Clean the environment.
Set locations and working directories…
Create a new analysis directories.
- general directory
- for plots
- for output of summary results
- for baseline tables
- for genetic analyses
- for Cox regression results
… a package-installation function …
source("scripts/functions.R")… and load those packages.
source("scripts/packages05.R")If prompted for GitHub credentials, enter your PAT in the password field
Using GITHUB_PAT from Sander W. van der Laan (credential helper: osxkeychain)
Using github PAT from envvar GITHUB_PAT
Skipping install of 'patchwork' from a github remote, the SHA1 (79223d30) has not changed since last install.
Use `force = TRUE` to force installation
Using github PAT from envvar GITHUB_PAT
Skipping install of 'RACER' from a github remote, the SHA1 (1394c9d4) has not changed since last install.
Use `force = TRUE` to force installation
We will create a datestamp and define the Utrecht Science Park Colour Scheme.
Today = format(as.Date(as.POSIXlt(Sys.time())), "%Y%m%d")
Today.Report = format(as.Date(as.POSIXlt(Sys.time())), "%A, %B %d, %Y")
source("scripts/colors.R")We will parse the data to create regional association plots for each of the 11 loci.
library("scales")
pal_npg("nrc")(10) [1] "#E64B35FF" "#4DBBD5FF" "#00A087FF" "#3C5488FF" "#F39B7FFF" "#8491B4FF" "#91D1C2FF" "#DC0000FF" "#7E6148FF"
[10] "#B09C85FF"
show_col(pal_npg("nrc")(10))
# show_col(pal_npg("nrc", alpha = 0.6)(10))We need to load the meta-analysis summary statistics from the European - African-American ancestry analysis first.
gwas_sumstats_racer_EA_AA <- readRDS(file = paste0(OUT_loc, "/gwas_sumstats_complete_racer.EA_AA.rds"))We need to load the meta-analysis summary statistics from the European-only ancestry analysis.
# gwas_sumstats_EA <- fread(paste0(GWAS_loc,"/CAC1000G_EA_FINAL_FUMA.txt.gz"),
# showProgress = TRUE)
# names(gwas_sumstats_EA)[names(gwas_sumstats_EA) == "Pos"] <- "Position"
# saveRDS(gwas_sumstats_EA, file = paste0(OUT_loc, "/gwas_sumstats.EA.rds"))
#
# gwas_sumstats_racer_EA <- subset(gwas_sumstats_EA,
# select = c("MarkerName", "rsID", "Chr", "Position", "Pvalue"))
#
# saveRDS(gwas_sumstats_racer_EA, file = paste0(OUT_loc, "/gwas_sumstats_racer.EA.rds"))
# rm(gwas_sumstats_EA)
gwas_sumstats_racer_EA <- readRDS(file = paste0(OUT_loc, "/gwas_sumstats_racer.EA.rds"))We need to load the meta-analysis summary statistics from the African-American-only ancestry analysis.
# gwas_sumstats_unfiltered_AA <- fread(paste0(GWAS_loc,"/CAC1000G_AA_FINAL_FUMA.unfiltered.txt.gz"),
# showProgress = TRUE)
# saveRDS(gwas_sumstats_unfiltered_AA, file = paste0(OUT_loc, "/gwas_sumstats_unfiltered.AA.rds"))
# gwas_sumstats_racer_unfiltered_AA <- subset(gwas_sumstats_unfiltered_AA,
# select = c("MarkerName", "rsID", "Chr", "Position", "Pvalue"))
#
# saveRDS(gwas_sumstats_racer_unfiltered_AA, file = paste0(OUT_loc, "/gwas_sumstats_unfiltered_racer.AA.rds"))
#
# gwas_sumstats_racer_unfiltered_AA <- readRDS(file = paste0(OUT_loc, "/gwas_sumstats_unfiltered_racer.AA.rds"))
#
# gwas_sumstats_AA <- fread(paste0(GWAS_loc,"/CAC1000G_AA_FINAL_FUMA.filtered.txt.gz"),
# showProgress = TRUE)
# saveRDS(gwas_sumstats_AA, file = paste0(OUT_loc, "/gwas_sumstats.AA.rds"))
#
# gwas_sumstats_racer_AA <- subset(gwas_sumstats_AA,
# select = c("MarkerName", "rsID", "Chr", "Position", "Pvalue"))
#
# saveRDS(gwas_sumstats_racer_AA, file = paste0(OUT_loc, "/gwas_sumstats_racer.AA.rds"))
# rm(gwas_sumstats_AA)
gwas_sumstats_racer_AA <- readRDS(file = paste0(OUT_loc, "/gwas_sumstats_racer.AA.rds"))We are interested in 11 top loci. We will plot these using the EU-AA-ancestry data.
library(openxlsx)
variant_list <- read.xlsx(paste0(TARGET_loc, "/Variants.xlsx"), sheet = "TopLoci")
DT::datatable(variant_list)NALet’s do some plotting.
library(RACER)
# Make directory for plots
ifelse(!dir.exists(file.path(PROJECT_loc, "/RACER")),
dir.create(file.path(PROJECT_loc, "/RACER")),
FALSE)[1] FALSE
RACER_loc = paste0(PROJECT_loc,"/RACER")
variants_of_interest <- c(variant_list$rsID)
variants_of_interest_fewgenes <- c("rs9349379")#, "rs3844006", "rs2854746", "rs4977575", "rs9633535", "rs11063120", "rs9515203", "rs7182103")
for(VARIANT in variants_of_interest){
cat(paste0("Getting data for ", VARIANT,".\n"))
tempCHR <- subset(variant_list, rsID == VARIANT)[,5]
tempSTART <- subset(variant_list, rsID == VARIANT)[,17]
tempEND <- subset(variant_list, rsID == VARIANT)[,18]
tempVARIANTnr <- subset(variant_list, rsID == VARIANT)[,1]
cat("\nSubset required data.\n")
temp <- subset(gwas_sumstats_racer_EA_AA, Chr == tempCHR & (Position >= tempSTART & Position <= tempEND))
cat("\nFormatting association data.\n")
temp_f = RACER::formatRACER(assoc_data = temp, chr_col = 3, pos_col = 4, p_col = 5)
cat("\nGetting LD data.\n")
temp_f_ld = RACER::ldRACER(assoc_data = temp_f, rs_col = 2, pops = "EUR", lead_snp = VARIANT)
cat(paste0("\nPlotting region surrounding ", VARIANT," on ",tempCHR,":",tempSTART,"-",tempEND,".\n"))
p1 <- singlePlotRACER2(assoc_data = temp_f_ld,
chr = tempCHR, build = "hg19",
plotby = "snp", snp_plot = VARIANT,
label_lead = TRUE, gene_track_h = 2, gene_name_s = 1.75)
print(p1)
cat(paste0("Saving image for ", VARIANT,".\n"))
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.png"), plot = last_plot())
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.pdf"), plot = last_plot())
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.eps"), plot = last_plot())
# rm(temp, p1,
# temp_f, temp_f_ld,
# tempCHR, tempSTART, tempEND,
# VARIANT, tempVARIANTnr)
}Getting data for rs9349379.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9349379...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9349379&pop=EUR&r2_d=r2&token=c0f613f149ab"
[45%] Downloaded 32210 bytes...
[100%] Downloaded 70967 bytes...
Merging input association data with LD...
Plotting region surrounding rs9349379 on 6:12403957-13403957.
Plotting by...
snp rs9349379
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs9349379.
Getting data for rs3844006.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs3844006...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs3844006&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 31016 bytes...
Merging input association data with LD...
Plotting region surrounding rs3844006 on 6:131595002-132595002.
Plotting by...
snp rs3844006
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs3844006.
Getting data for rs2854746.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs2854746...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs2854746&pop=EUR&r2_d=r2&token=c0f613f149ab"
[44%] Downloaded 49152 bytes...
[59%] Downloaded 65518 bytes...
[74%] Downloaded 81920 bytes...
[89%] Downloaded 98286 bytes...
[100%] Downloaded 109298 bytes...
Merging input association data with LD...
Plotting region surrounding rs2854746 on 7:45460645-46460645.
Plotting by...
snp rs2854746
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs2854746.
Getting data for rs4977575.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs4977575...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs4977575&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 26000 bytes...
Merging input association data with LD...
Plotting region surrounding rs4977575 on 9:21624744-22624744.
Plotting by...
snp rs4977575
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs4977575.
Getting data for rs10899970.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10899970...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10899970&pop=EUR&r2_d=r2&token=c0f613f149ab"
[35%] Downloaded 57344 bytes...
[56%] Downloaded 90112 bytes...
[100%] Downloaded 160476 bytes...
Merging input association data with LD...
Plotting region surrounding rs10899970 on 10:44015716-45334720.
Plotting by...
snp rs10899970
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs10899970.
Getting data for rs9633535.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9633535...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9633535&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 49363 bytes...
Merging input association data with LD...
Plotting region surrounding rs9633535 on 10:63336088-64336088.
Plotting by...
snp rs9633535
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs9633535.
Getting data for rs10762577.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10762577...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10762577&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 92997 bytes...
Merging input association data with LD...
Plotting region surrounding rs10762577 on 10:75417431-76417431.
Plotting by...
snp rs10762577
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs10762577.
Getting data for rs11063120.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs11063120...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs11063120&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 41883 bytes...
Merging input association data with LD...
Plotting region surrounding rs11063120 on 12:3986618-4986618.
Plotting by...
snp rs11063120
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs11063120.
Getting data for rs9515203.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9515203...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9515203&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 30139 bytes...
Merging input association data with LD...
Plotting region surrounding rs9515203 on 13:110549623-111549623.
Plotting by...
snp rs9515203
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs9515203.
Getting data for rs7182103.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7182103...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7182103&pop=EUR&r2_d=r2&token=c0f613f149ab"
[27%] Downloaded 32209 bytes...
[76%] Downloaded 90112 bytes...
[100%] Downloaded 118299 bytes...
Merging input association data with LD...
Plotting region surrounding rs7182103 on 15:78623946-79623946.
Plotting by...
snp rs7182103
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs7182103.
Getting data for rs7412.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7412...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7412&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 38865 bytes...
Merging input association data with LD...
Plotting region surrounding rs7412 on 19:44912079-45912079.
Plotting by...
snp rs7412
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs7412.
These are genetic loci with many genes.
variants_of_interest_manygenes <- c("rs7412", "rs10762577")
for(VARIANT in variants_of_interest_manygenes){
cat(paste0("Getting data for ", VARIANT,".\n"))
tempCHR <- subset(variant_list, rsID == VARIANT)[,5]
tempSTART <- subset(variant_list, rsID == VARIANT)[,17]
tempEND <- subset(variant_list, rsID == VARIANT)[,18]
tempVARIANTnr <- subset(variant_list, rsID == VARIANT)[,1]
cat("\nSubset required data.\n")
temp <- subset(gwas_sumstats_racer_EA_AA, Chr == tempCHR & (Position >= tempSTART & Position <= tempEND))
cat("\nFormatting association data.\n")
temp_f = RACER::formatRACER(assoc_data = temp, chr_col = 3, pos_col = 4, p_col = 5)
cat("\nGetting LD data.\n")
temp_f_ld = RACER::ldRACER(assoc_data = temp_f, rs_col = 2, pops = "EUR", lead_snp = VARIANT)
cat(paste0("\nPlotting region surrounding ", VARIANT," on ",tempCHR,":",tempSTART,"-",tempEND,".\n"))
p1 <- singlePlotRACER2(assoc_data = temp_f_ld,
chr = tempCHR, build = "hg19",
plotby = "snp", snp_plot = VARIANT,
label_lead = TRUE, gene_track_h = 0.75, gene_name_s = 1.75)
print(p1)
cat(paste0("Saving image for ", VARIANT,".\n"))
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.png"), plot = last_plot())
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.pdf"), plot = last_plot())
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.eps"), plot = last_plot())
rm(temp, p1,
temp_f, temp_f_ld,
tempCHR, tempSTART, tempEND,
VARIANT, tempVARIANTnr)
}Getting data for rs7412.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7412...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7412&pop=EUR&r2_d=r2&token=c0f613f149ab"
Merging input association data with LD...
Plotting region surrounding rs7412 on 19:44912079-45912079.
Plotting by...
snp rs7412
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs7412.
Getting data for rs10762577.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10762577...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10762577&pop=EUR&r2_d=r2&token=c0f613f149ab"
[52%] Downloaded 48576 bytes...
[59%] Downloaded 55496 bytes...
[77%] Downloaded 71862 bytes...
[100%] Downloaded 92997 bytes...
Merging input association data with LD...
Plotting region surrounding rs10762577 on 10:75417431-76417431.
Plotting by...
snp rs10762577
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs10762577.
The CXCL12 genetic locus.
variants_of_interest_cxcl12 <- c("rs10899970")
for(VARIANT in variants_of_interest_cxcl12){
cat(paste0("Getting data for ", VARIANT,".\n"))
tempCHR <- subset(variant_list, rsID == VARIANT)[,5]
tempSTART <- subset(variant_list, rsID == VARIANT)[,17]
tempEND <- subset(variant_list, rsID == VARIANT)[,18]
tempVARIANTnr <- subset(variant_list, rsID == VARIANT)[,1]
cat("\nSubset required data.\n")
temp <- subset(gwas_sumstats_racer_EA_AA, Chr == tempCHR & (Position >= tempSTART & Position <= tempEND))
cat("\nFormatting association data.\n")
temp_f = RACER::formatRACER(assoc_data = temp, chr_col = 3, pos_col = 4, p_col = 5)
cat("\nGetting LD data.\n")
temp_f_ld = RACER::ldRACER(assoc_data = temp_f, rs_col = 2, pops = "EUR", lead_snp = VARIANT)
cat(paste0("\nPlotting region surrounding ", VARIANT," on ",tempCHR,":",tempSTART,"-",tempEND,".\n"))
p1 <- singlePlotRACER2(assoc_data = temp_f_ld,
chr = tempCHR, build = "hg19", set = "all",
plotby = "snp", snp_plot = VARIANT,
label_lead = TRUE, gene_track_h = 0.75, gene_name_s = 1.75)
print(p1)
cat(paste0("Saving image for ", VARIANT,".\n"))
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.png"), plot = last_plot())
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.pdf"), plot = last_plot())
# ggsave(filename = paste0(RACER_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.eps"), plot = last_plot())
rm(temp, p1,
temp_f, temp_f_ld,
tempCHR, tempSTART, tempEND,
VARIANT, tempVARIANTnr)
}Getting data for rs10899970.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10899970...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10899970&pop=EUR&r2_d=r2&token=c0f613f149ab"
[45%] Downloaded 73710 bytes...
[86%] Downloaded 139246 bytes...
[100%] Downloaded 160476 bytes...
Merging input association data with LD...
Plotting region surrounding rs10899970 on 10:44015716-45334720.
Plotting by...
snp rs10899970
Reading in association data
Determining lead SNP
Generating Plot
Saving image for rs10899970.
We want to create some regional association plots to combine with teh UCSC browser tracks, thus we need the exact same regions.
library(openxlsx)
add_list <- read.xlsx(paste0(TARGET_loc, "/Variants.xlsx"), sheet = "AdditionalPlots")
DT::datatable(add_list)NAWe want to color the credible sets, which we load here.
credset <- as_tibble(fread(paste0(PROJECT_loc, "/CredibleSets/CAC_EUR_AFR_cred_set_all_loci_50kb.txt")))
credsetWe want to add the posterior probabilities and make a variable to color by.
gwas_sumstats_racer_credset <- merge(gwas_sumstats_racer_EA_AA,
credset %>% select(RSID, Posterior_Prob),
sort = FALSE,
by.x = "rsID", by.y = "RSID", all.x = TRUE) %>%
# mutate(., Posterior_Prob = ifelse(is.na(Posterior_Prob), 0, Posterior_Prob)) %>%
mutate(CredSet = case_when(Posterior_Prob > 0 ~ '95% credible set',
TRUE ~ 'not in credible set'))
head(gwas_sumstats_racer_credset)
table(gwas_sumstats_racer_credset$CredSet)
95% credible set not in credible set
103 8585944
summary(gwas_sumstats_racer_credset$Posterior_Prob) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0 0 0 0 0 1 8585944
library(RACER)
# library(plotly)
# Make directory for plots
ifelse(!dir.exists(file.path(PROJECT_loc, "/RACER")),
dir.create(file.path(PROJECT_loc, "/RACER")),
FALSE)[1] FALSE
RACER_loc = paste0(PROJECT_loc,"/RACER")
variants_of_interest <- c(add_list$rsID)
for(VARIANT in variants_of_interest){
cat(paste0("Getting data for ", VARIANT,".\n"))
tempCHR <- subset(add_list, rsID == VARIANT)[,4]
tempSTART <- subset(add_list, rsID == VARIANT)[,5]
tempEND <- subset(add_list, rsID == VARIANT)[,6]
tempNAME <- subset(add_list, rsID == VARIANT)[,3]
cat("\nSubset required data.\n")
temp <- subset(gwas_sumstats_racer_credset, Chr == tempCHR & (Position >= tempSTART & Position <= tempEND))
cat("\nFormatting association data.\n")
temp_f = RACER::formatRACER(assoc_data = temp, chr_col = 3, pos_col = 4, p_col = 5)
cat("\nGetting LD data.\n")
# temp_f_ld = RACER::ldRACER(assoc_data = temp_f, rs_col = 2, pops = "EUR", lead_snp = VARIANT)
cat(paste0("\nPlotting region surrounding ", VARIANT," on ",tempCHR,":",tempSTART,"-",tempEND,".\n"))
p1 <- singlePlotRACER2(assoc_data = temp_f,
chr = tempCHR, build = "hg19",
plotby = "coord", snp_plot = VARIANT,
start_plot = tempSTART, end_plot = tempEND,
label_lead = FALSE,
grey_colors = FALSE,
cred_set = TRUE,
gene_track_h = 3, gene_name_s = 1.75)
print(p1)
cat(paste0("Saving image for ", VARIANT,".\n"))
# ggsave(filename = paste0(RACER_loc, "/", tempNAME, ".", Today, ".",VARIANT,".",tempSTART,".",tempEND,".regional_assoc.png"), plot = p1)
# ggsave(filename = paste0(RACER_loc, "/", tempNAME, ".", Today, ".",VARIANT,".",tempSTART,".",tempEND,".regional_assoc.pdf"), plot = p1)
# ggsave(filename = paste0(RACER_loc, "/", tempNAME, ".", Today, ".",VARIANT,".",tempSTART,".",tempEND,".regional_assoc.eps"), plot = p1)
# print(ggplotly(p1))
rm(temp, p1,
temp_f,
tempCHR, tempSTART, tempEND,
VARIANT, tempNAME)
}Getting data for rs9633535.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
Plotting region surrounding rs9633535 on 10:63584853-63921073.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Collecting posterior probabilities
Generating Plot
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Saving image for rs9633535.
Getting data for rs2854746.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
Plotting region surrounding rs2854746 on 7:45894617-46054070.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Collecting posterior probabilities
Generating Plot
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Saving image for rs2854746.
Getting data for rs3844006.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Getting LD data.
Plotting region surrounding rs3844006 on 6:131937915-132289374.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Collecting posterior probabilities
Generating Plot
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Saving image for rs3844006.
Note here that we plot the region, and not based on the lead variant of the EA-AA analyses.
library(RACER)
# Make directory for plots
ifelse(!dir.exists(file.path(PROJECT_loc, "/RACER_AA")),
dir.create(file.path(PROJECT_loc, "/RACER_AA")),
FALSE)[1] FALSE
RACER_AA_loc = paste0(PROJECT_loc,"/RACER_AA")
variants_of_interest <- c(variant_list$rsID)
variants_of_interest_fewgenes <- c("rs9349379",
"rs3844006", # throws an error which I don't understand immediately - could be that the variant is not present in AA 1000G data
"rs2854746", "rs4977575",
"rs10899970",
"rs9633535", # this one throws an LD error
"rs10762577",
"rs11063120", "rs9515203", "rs7182103",
"rs7412")
for(VARIANT in variants_of_interest){
cat(paste0("Getting data for ", VARIANT,".\n"))
tempCHR <- subset(variant_list, rsID == VARIANT)[,5]
tempSTART <- subset(variant_list, rsID == VARIANT)[,17]
tempEND <- subset(variant_list, rsID == VARIANT)[,18]
tempVARIANTnr <- subset(variant_list, rsID == VARIANT)[,1]
cat("\nSubset required data.\n")
temp <- subset(gwas_sumstats_racer_AA, Chr == tempCHR & (Position >= tempSTART & Position <= tempEND))
cat("\nFormatting association data.\n")
temp_f = RACER::formatRACER(assoc_data = temp, chr_col = 3, pos_col = 4, p_col = 5)
# cat("\nGetting LD data.\n")
temp_f_ld = RACER::ldRACER(assoc_data = temp_f, rs_col = 2, pops = "AFR", lead_snp = VARIANT)
cat(paste0("\nPlotting region surrounding ", VARIANT," on ",tempCHR,":",tempSTART,"-",tempEND,".\n"))
p1 <- singlePlotRACER2(assoc_data = temp_f,
chr = tempCHR, build = "hg19",
plotby = "coord", snp_plot = VARIANT,
start_plot = tempSTART, end_plot = tempEND,
label_lead = FALSE, gene_track_h = 2, gene_name_s = 1.75)
print(p1)
cat(paste0("Saving image for ", VARIANT,".\n"))
ggsave(filename = paste0(RACER_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.AA.png"), plot = last_plot())
ggsave(filename = paste0(RACER_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.AA.pdf"), plot = last_plot())
ggsave(filename = paste0(RACER_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_assoc.AA.eps"), plot = last_plot())
rm(temp, p1,
temp_f, temp_f_ld,
tempCHR, tempSTART, tempEND,
VARIANT, tempVARIANTnr)
}Getting data for rs9349379.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9349379...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9349379&pop=AFR&r2_d=r2&token=c0f613f149ab"
[16%] Downloaded 15980 bytes...
[33%] Downloaded 32210 bytes...
[50%] Downloaded 48576 bytes...
[100%] Downloaded 95751 bytes...
Merging input association data with LD...
Plotting region surrounding rs9349379 on 6:12403957-13403957.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs9349379.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs3844006.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs3844006...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs3844006&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 72560 bytes...
Merging input association data with LD...
Plotting region surrounding rs3844006 on 6:131595002-132595002.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs3844006.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs2854746.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs2854746...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs2854746&pop=AFR&r2_d=r2&token=c0f613f149ab"
[22%] Downloaded 15980 bytes...
[100%] Downloaded 71651 bytes...
Merging input association data with LD...
Plotting region surrounding rs2854746 on 7:45460645-46460645.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs2854746.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs4977575.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs4977575...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs4977575&pop=AFR&r2_d=r2&token=c0f613f149ab"
[17%] Downloaded 15980 bytes...
[100%] Downloaded 93249 bytes...
Merging input association data with LD...
Plotting region surrounding rs4977575 on 9:21624744-22624744.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs4977575.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs10899970.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10899970...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10899970&pop=AFR&r2_d=r2&token=c0f613f149ab"
[35%] Downloaded 64977 bytes...
[61%] Downloaded 114688 bytes...
[70%] Downloaded 131054 bytes...
[79%] Downloaded 147456 bytes...
[100%] Downloaded 185291 bytes...
Merging input association data with LD...
Plotting region surrounding rs10899970 on 10:44015716-45334720.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs10899970.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs9633535.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9633535...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9633535&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 42221 bytes...
Merging input association data with LD...
Plotting region surrounding rs9633535 on 10:63336088-64336088.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs9633535.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs10762577.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10762577...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10762577&pop=AFR&r2_d=r2&token=c0f613f149ab"
[78%] Downloaded 114111 bytes...
[90%] Downloaded 130513 bytes...
[100%] Downloaded 144558 bytes...
Merging input association data with LD...
Plotting region surrounding rs10762577 on 10:75417431-76417431.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs10762577.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs11063120.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs11063120...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs11063120&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 46036 bytes...
Merging input association data with LD...
Plotting region surrounding rs11063120 on 12:3986618-4986618.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs11063120.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs9515203.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9515203...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9515203&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 41921 bytes...
Merging input association data with LD...
Plotting region surrounding rs9515203 on 13:110549623-111549623.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs9515203.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs7182103.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7182103...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7182103&pop=AFR&r2_d=r2&token=c0f613f149ab"
[72%] Downloaded 81343 bytes...
[87%] Downloaded 97745 bytes...
[100%] Downloaded 111697 bytes...
Merging input association data with LD...
Plotting region surrounding rs7182103 on 15:78623946-79623946.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs7182103.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs7412.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7412...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7412&pop=AFR&r2_d=r2&token=c0f613f149ab"
[48%] Downloaded 15980 bytes...
[100%] Downloaded 33190 bytes...
Merging input association data with LD...
Plotting region surrounding rs7412 on 19:44912079-45912079.
Association Data Set is missing LD data, the resulting plot won't have LD information, but you can add it using the ldRACER.R function.
Plotting by...
coord
Reading in association data
Generating Plot
Saving image for rs7412.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
library(RACER)
# Make directory for plots
ifelse(!dir.exists(file.path(PROJECT_loc, "/RACER_EA_vs_AA")),
dir.create(file.path(PROJECT_loc, "/RACER_EA_vs_AA")),
FALSE)[1] FALSE
RACER_EA_vs_AA_loc = paste0(PROJECT_loc,"/RACER_EA_vs_AA")
variants_of_interest <- c(variant_list$rsID)
# variants_of_interest_fewgenes <- c("rs9349379",
# "rs3844006", # throws an error which I don't understand immediately - could be that the variant is not present in AA 1000G data
# "rs2854746", "rs4977575",
# "rs10899970",
# "rs9633535",
# "rs10762577",
# "rs11063120", "rs9515203", "rs7182103",
# "rs7412")
variants_of_interest_fewgenes <- c("rs10762577",
"rs11063120", "rs9515203", "rs7182103",
"rs7412")
for(VARIANT in variants_of_interest){
cat(paste0("Getting data for ", VARIANT,".\n"))
tempCHR <- subset(variant_list, rsID == VARIANT)[,5]
tempSTART <- subset(variant_list, rsID == VARIANT)[,17]
tempEND <- subset(variant_list, rsID == VARIANT)[,18]
tempVARIANTnr <- subset(variant_list, rsID == VARIANT)[,1]
cat("\nSubset required data.\n")
temp1 <- subset(gwas_sumstats_racer_EA, Chr == tempCHR & (Position >= tempSTART & Position <= tempEND))
temp2 <- subset(gwas_sumstats_racer_AA, Chr == tempCHR & (Position >= tempSTART & Position <= tempEND))
cat("\nFormatting association data.\n")
temp_f1 = RACER::formatRACER(assoc_data = temp1, chr_col = 3, pos_col = 4, p_col = 5)
temp_f2 = RACER::formatRACER(assoc_data = temp2, chr_col = 3, pos_col = 4, p_col = 5)
# cat("\nGetting LD data.\n")
temp_f_ld1 = RACER::ldRACER(assoc_data = temp_f1, rs_col = 2, pops = "EUR", lead_snp = VARIANT)
temp_f_ld2 = RACER::ldRACER(assoc_data = temp_f2, rs_col = 2, pops = "AFR", lead_snp = VARIANT)
cat(paste0("\nPlotting region surrounding ", VARIANT," on ",tempCHR,":",tempSTART,"-",tempEND,".\n"))
p1 <- mirrorPlotRACER(assoc_data1 = temp_f_ld1,
assoc_data2 = temp_f_ld2,
chr = tempCHR,
name1 = "European ancestry",
name2 = "African-American ancestry",
plotby = "coord",
start_plot = tempSTART, end_plot = tempEND)
print(p1)
p2 <- scatterPlotRACER(assoc_data1 = temp_f_ld1,
assoc_data2 = temp_f_ld2,
chr = tempCHR,
name1 = "European ancestry",
name2 = "African-American ancestry",
region_start = tempSTART,
region_end = tempEND,
ld_df = 1)
print(p2)
cat(paste0("Saving image for ", VARIANT,".\n"))
ggsave(filename = paste0(RACER_EA_vs_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_mirror.EA_vs_AA.png"), plot = p1)
ggsave(filename = paste0(RACER_EA_vs_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_mirror.EA_vs_AA.pdf"), plot = p1)
ggsave(filename = paste0(RACER_EA_vs_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_mirror.EA_vs_AA.eps"), plot = p1)
cat(paste0("Saving image for ", VARIANT,".\n"))
ggsave(filename = paste0(RACER_EA_vs_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_scatter.EA_vs_AA.png"), plot = p2)
ggsave(filename = paste0(RACER_EA_vs_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_scatter.EA_vs_AA.pdf"), plot = p2)
ggsave(filename = paste0(RACER_EA_vs_AA_loc, "/", tempVARIANTnr, ".", Today, ".",VARIANT,".regional_scatter.EA_vs_AA.eps"), plot = p2)
rm(temp1, temp2,
p1,p2,
temp_f1, temp_f_ld1,
temp_f2, temp_f_ld2,
tempCHR, tempSTART, tempEND,
VARIANT, tempVARIANTnr)
}Getting data for rs9349379.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9349379...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9349379&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 70967 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9349379...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9349379&pop=AFR&r2_d=r2&token=c0f613f149ab"
[50%] Downloaded 48576 bytes...
[57%] Downloaded 55496 bytes...
[100%] Downloaded 95751 bytes...
Merging input association data with LD...
Plotting region surrounding rs9349379 on 6:12403957-13403957.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs9349379.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs9349379.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs3844006.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs3844006...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs3844006&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 31016 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs3844006...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs3844006&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 72560 bytes...
Merging input association data with LD...
Plotting region surrounding rs3844006 on 6:131595002-132595002.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs3844006.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs3844006.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs2854746.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs2854746...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs2854746&pop=EUR&r2_d=r2&token=c0f613f149ab"
[80%] Downloaded 88263 bytes...
[95%] Downloaded 104629 bytes...
[100%] Downloaded 109298 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs2854746...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs2854746&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 71651 bytes...
Merging input association data with LD...
Plotting region surrounding rs2854746 on 7:45460645-46460645.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs2854746.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs2854746.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs4977575.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs4977575...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs4977575&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 26000 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs4977575...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs4977575&pop=AFR&r2_d=r2&token=c0f613f149ab"
[59%] Downloaded 55496 bytes...
[94%] Downloaded 88264 bytes...
[100%] Downloaded 93249 bytes...
Merging input association data with LD...
Plotting region surrounding rs4977575 on 9:21624744-22624744.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs4977575.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs4977575.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs10899970.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10899970...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10899970&pop=EUR&r2_d=r2&token=c0f613f149ab"
[51%] Downloaded 81920 bytes...
[61%] Downloaded 98286 bytes...
[71%] Downloaded 114688 bytes...
[81%] Downloaded 131054 bytes...
[100%] Downloaded 160476 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10899970...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10899970&pop=AFR&r2_d=r2&token=c0f613f149ab"
[8%] Downloaded 15979 bytes...
[30%] Downloaded 57344 bytes...
[39%] Downloaded 73710 bytes...
[75%] Downloaded 139246 bytes...
[84%] Downloaded 155648 bytes...
[100%] Downloaded 185291 bytes...
Merging input association data with LD...
Plotting region surrounding rs10899970 on 10:44015716-45334720.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs10899970.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs10899970.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs9633535.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9633535...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9633535&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 49363 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9633535...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9633535&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 42221 bytes...
Merging input association data with LD...
Plotting region surrounding rs9633535 on 10:63336088-64336088.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs9633535.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs9633535.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs10762577.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10762577...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10762577&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 92997 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs10762577...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs10762577&pop=AFR&r2_d=r2&token=c0f613f149ab"
[56%] Downloaded 81920 bytes...
[100%] Downloaded 144558 bytes...
Merging input association data with LD...
Plotting region surrounding rs10762577 on 10:75417431-76417431.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs10762577.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs10762577.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs11063120.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs11063120...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs11063120&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 41883 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs11063120...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs11063120&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 46036 bytes...
Merging input association data with LD...
Plotting region surrounding rs11063120 on 12:3986618-4986618.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs11063120.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs11063120.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs9515203.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9515203...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9515203&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 30139 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs9515203...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs9515203&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 41921 bytes...
Merging input association data with LD...
Plotting region surrounding rs9515203 on 13:110549623-111549623.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs9515203.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs9515203.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs7182103.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7182103...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7182103&pop=EUR&r2_d=r2&token=c0f613f149ab"
[55%] Downloaded 65518 bytes...
[83%] Downloaded 98286 bytes...
[100%] Downloaded 118299 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7182103...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7182103&pop=AFR&r2_d=r2&token=c0f613f149ab"
[64%] Downloaded 71861 bytes...
[79%] Downloaded 88263 bytes...
[100%] Downloaded 111697 bytes...
Merging input association data with LD...
Plotting region surrounding rs7182103 on 15:78623946-79623946.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Reading in association data
Generating plot.
Saving image for rs7182103.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs7182103.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Getting data for rs7412.
Subset required data.
Formatting association data.
Formating association data...
Processing -log10(p-values)...
Preparing association data...
Formating association data...
Processing -log10(p-values)...
Preparing association data...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7412...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7412&pop=EUR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 38865 bytes...
Merging input association data with LD...
All inputs are go!
Reading in association data...
Populations selected.
Calculating LD using rs7412...
[1] "https://ldlink.nci.nih.gov/LDlinkRest/ldproxy?var=rs7412&pop=AFR&r2_d=r2&token=c0f613f149ab"
[100%] Downloaded 33190 bytes...
Merging input association data with LD...
Plotting region surrounding rs7412 on 19:44912079-45912079.
Plotting by...
coord
Reading in association data
Generating plot.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Warning: Removed 1 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_text).
Reading in association data
Generating plot.
Saving image for rs7412.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving image for rs7412.
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Saving 7.29 x 4.51 in image
Version: v1.4.1
Last update: 2022-06-28
Written by: Sander W. van der Laan (s.w.vanderlaan-2[at]umcutrecht.nl).
Description: Script to create plot regional association plots.
Minimum requirements: R version 3.4.3 (2017-06-30) -- 'Single Candle', Mac OS X El Capitan
Changes log
* v1.4.1 Added mirror plots and scatter plots.
* v1.4.0 Update with AA data.
* v1.3.0 Added the credible sets to the aditional regions.
* v1.2.0 Added in aditional regions.
* v1.1.0 Created PNG and PDF of top loci regions.
* v1.0.0 Initial version.
sessionInfo()R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid tools stats graphics grDevices utils datasets methods base
other attached packages:
[1] scales_1.2.0 openxlsx_4.2.5 pander_0.6.5 ggsci_2.9 ggrepel_0.9.1
[6] RACER_1.0.0 credentials_1.3.2 UpSetR_1.4.0 ggpubr_0.4.0 forestplot_2.0.1
[11] checkmate_2.1.0 magrittr_2.0.3 pheatmap_1.0.12 devtools_2.4.3 usethis_2.1.6
[16] BlandAltmanLeh_0.3.1 tableone_0.13.2 haven_2.5.0 eeptools_1.2.4 DT_0.23
[21] knitr_1.39 forcats_0.5.1 stringr_1.4.0 purrr_0.3.4 tibble_3.1.7
[26] ggplot2_3.3.6 tidyverse_1.3.1 data.table_1.14.2 naniar_0.6.1 tidyr_1.2.0
[31] dplyr_1.0.9 optparse_1.7.1 readr_2.1.2 R.utils_2.12.0 R.oo_1.25.0
[36] R.methodsS3_1.8.2
loaded via a namespace (and not attached):
[1] readxl_1.4.0 backports_1.4.1 systemfonts_1.0.4 plyr_1.8.7 sp_1.5-0 splines_4.2.1
[7] crosstalk_1.2.0 digest_0.6.29 htmltools_0.5.2 fansi_1.0.3 memoise_2.0.1 tzdb_0.3.0
[13] remotes_2.4.2 modelr_0.1.8 askpass_1.1 prettyunits_1.1.1 colorspace_2.0-3 rvest_1.0.2
[19] mitools_2.4 textshaping_0.3.6 xfun_0.31 callr_3.7.0 crayon_1.5.1 jsonlite_1.8.0
[25] lme4_1.1-29 survival_3.3-1 zoo_1.8-10 glue_1.6.2 gtable_0.3.0 car_3.1-0
[31] pkgbuild_1.3.1 abind_1.4-5 DBI_1.1.3 rstatix_0.7.0 Rcpp_1.0.8.3 foreign_0.8-82
[37] survey_4.1-1 vcd_1.4-10 htmlwidgets_1.5.4 httr_1.4.3 getopt_1.20.3 RColorBrewer_1.1-3
[43] ellipsis_0.3.2 pkgconfig_2.0.3 farver_2.1.0 sass_0.4.1 dbplyr_2.2.1 utf8_1.2.2
[49] labeling_0.4.2 reshape2_1.4.4 tidyselect_1.1.2 rlang_1.0.3 munsell_0.5.0 cellranger_1.1.0
[55] cachem_1.0.6 cli_3.3.0 generics_0.1.2 broom_0.8.0 evaluate_0.15 fastmap_1.1.0
[61] ragg_1.2.2 arm_1.12-2 yaml_2.3.5 sys_3.4 processx_3.6.1 fs_1.5.2
[67] zip_2.2.0 visdat_0.5.3 nlme_3.1-157 xml2_1.3.3 compiler_4.2.1 rstudioapi_0.13
[73] curl_4.3.2 ggsignif_0.6.3 reprex_2.0.1 bslib_0.3.1 stringi_1.7.6 ps_1.7.1
[79] lattice_0.20-45 Matrix_1.4-1 nloptr_2.0.3 vctrs_0.4.1 pillar_1.7.0 lifecycle_1.0.1
[85] jquerylib_0.1.4 lmtest_0.9-40 cowplot_1.1.1 maptools_1.1-4 R6_2.5.1 gridExtra_2.3
[91] sessioninfo_1.2.2 boot_1.3-28 MASS_7.3-57 assertthat_0.2.1 pkgload_1.3.0 openssl_2.0.2
[97] rprojroot_2.0.3 withr_2.5.0 hms_1.1.1 coda_0.19-4 minqa_1.2.4 rmarkdown_2.14
[103] carData_3.0-5 lubridate_1.8.0
save.image(paste0(PROJECT_loc, "/",Today,".",PROJECTNAME,".RegionalAssociationPlots.RData"))| © 1979-2022 Sander W. van der Laan | s.w.vanderlaan[at]gmail.com | swvanderlaan.github.io. |